Skip to content

fix(security): restrict CORS allow_methods to GET, POST, OPTIONS#2241

Open
nyxsky404 wants to merge 1 commit into
janavipandole:mainfrom
nyxsky404:fix/cors-restrict-allowed-methods
Open

fix(security): restrict CORS allow_methods to GET, POST, OPTIONS#2241
nyxsky404 wants to merge 1 commit into
janavipandole:mainfrom
nyxsky404:fix/cors-restrict-allowed-methods

Conversation

@nyxsky404

@nyxsky404 nyxsky404 commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

📄 Description

allow_methods=["*"] in the CORS middleware exposed DELETE, PUT, PATCH, TRACE, and other HTTP methods to cross-origin requests.

Replaced the wildcard with an explicit allowlist ["GET", "POST", "OPTIONS"] — the only three methods used by the API. OPTIONS is required for preflight requests.

🔗 Related Issues

Fixes #2236

🧩 Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature
  • Breaking change
  • Documentation update

✅ Checklist

  • Code follows project styling guidelines
  • Changes are fully responsive and accessible
  • No extraneous logs or debug code left
  • Documentation updated accordingly
  • Built successfully locally
  • Console has zero errors or warnings

Wildcard allow_methods exposed DELETE, PUT, PATCH, TRACE etc.
Limit to the three methods the API actually uses to reduce
the cross-origin attack surface.
@vercel

vercel Bot commented Jun 13, 2026

Copy link
Copy Markdown

@nyxsky404 is attempting to deploy a commit to the janavipandole's projects Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[SECURITY] CORS middleware uses allow_methods=["*"] — exposes DELETE, TRACE and all HTTP verbs unnecessarily

1 participant